package x.trident.core.micro.api.exception.enums;

import lombok.Getter;
import x.trident.core.constants.BaseConstants;
import x.trident.core.exception.AbstractExceptionEnum;
import x.trident.core.micro.api.constants.MicroConstants;

/**
 * 微服务的异常枚举
 *
 * @author Seven
 * @date 2021/5/10 10:20
 */
@Getter
public enum MicroExceptionEnum implements AbstractExceptionEnum {

    /**
     * 微服务异常
     */
    MICRO_EXCEPTION(BaseConstants.BUSINESS_ERROR_TYPE_CODE + MicroConstants.MICRO_EXCEPTION_STEP_CODE + "01", "微服务异常，具体信息：{}"),

    /**
     * 请求参数存在空值
     */
    REQUEST_EMPTY(BaseConstants.BUSINESS_ERROR_TYPE_CODE + MicroConstants.MICRO_EXCEPTION_STEP_CODE + "02", "请求参数{}为空，请检查请求参数"),

    /**
     * 配置无法解析出对应的类
     */
    CONFIG_PARSE_ERROR(BaseConstants.BUSINESS_ERROR_TYPE_CODE + MicroConstants.MICRO_EXCEPTION_STEP_CODE + "03", "配置无法解析出对应类"),

    /**
     * 读取不到配置
     */
    CONFIG_EMPTY(BaseConstants.BUSINESS_ERROR_TYPE_CODE + MicroConstants.MICRO_EXCEPTION_STEP_CODE + "04", "读不到配置"),

    /**
     * 读配置异常
     */
    CONFIG_ERROR(BaseConstants.BUSINESS_ERROR_TYPE_CODE + MicroConstants.MICRO_EXCEPTION_STEP_CODE + "04", "读配置异常");


    /**
     * 错误编码
     */
    private final String errorCode;

    /**
     * 提示用户信息
     */
    private final String userTip;

    MicroExceptionEnum(String errorCode, String userTip) {
        this.errorCode = errorCode;
        this.userTip = userTip;
    }

}
